﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DepartmentListFrame.ascx.cs"
    Inherits="AB.ServiceDirectory.Design.WebUserControls.Frame.DepartmentListFrame" %>
<script type="text/javascript">
    function Confirm_Active() {
        return confirm('Do you want active this Department ?');
    }
</script>
<asp:UpdatePanel runat="server" ID="UpdatePanelDepartmentList">
    <ContentTemplate>
        <div class="titleh">
            <h3 class="sorting_range">
                <asp:LinkButton ID="LinkButtonAll" runat="server" OnCommand="FilterByLetters_Command"
                    CommandName="all" CausesValidation="False" CssClass="hg-blue" 
                    ClientIDMode="Static">All</asp:LinkButton>
                <asp:LinkButton ID="LinkButton09" runat="server" CommandName="09" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">0-9</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonAE" runat="server" CommandName="ae" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">A B C D E</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonFJ" runat="server" CommandName="fj" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">F G H I J</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonKN" runat="server" CommandName="kn" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">K L M N </asp:LinkButton>
                <asp:LinkButton ID="LinkButtonOR" runat="server" CommandName="or" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">O P Q R</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonSV" runat="server" CommandName="sv" OnCommand="FilterByLetters_Command"
                    CausesValidation="False" ClientIDMode="Static">S T U V</asp:LinkButton>
                <asp:LinkButton ID="LinkButtonWZ" CssClass="last" runat="server" CommandName="wz"
                    OnCommand="FilterByLetters_Command" CausesValidation="False" 
                    ClientIDMode="Static">W X Y Z</asp:LinkButton>
                <span class="right">
                    <asp:LinkButton ID="LinkButtonCreate" runat="server" CssClass="hg-blue" OnClick="LinkButtonCreate_Click"
                        CausesValidation="False">Create</asp:LinkButton>
                    <asp:CheckBox ID="CheckBoxInactive" runat="server" Text="Include In-active" AutoPostBack="True"
                        OnCheckedChanged="CheckBoxInactive_CheckedChanged" />
                </span>
            </h3>
        </div>
        <asp:GridView ID="GridViewDepartmentList" runat="server" CssClass="tablesorter" AutoGenerateColumns="False"
            DataSourceID="ObjectDataSourceDepartmentList" AllowPaging="True" PageSize="15"
            AllowSorting="True">
            <Columns>
                <asp:TemplateField HeaderText="Department Name" SortExpression="DepartmentName">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButtonDepartmentName" CausesValidation="false" runat="server" CommandName='<%# Eval("DepartmentId") %>' CommandArgument='<%#Eval("IsActive") %>'
                        OnClientClick='<%# !(bool)Eval("IsActive") ? "return Confirm_Active();" : string.Empty %>' OnCommand="LinkButtonDepartmentName_Command"><%# Eval("DepartmentName") %></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle CssClass="header" Width="168px"/>
            </asp:TemplateField>
                <asp:TemplateField HeaderText="Address Line 1" SortExpression="AddressLine">
                    <ItemTemplate>
                        <%#Eval("Address.AddressLine") %>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Postcode" SortExpression="Postcode">
                    <ItemTemplate>
                        <%#Eval("Address.Postcode") %>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" Width="170px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Contact" SortExpression="Surname">
                    <ItemTemplate>
                        <%#Eval("Contact.Surname") %>
                    </ItemTemplate>
                    <HeaderStyle CssClass="header" Width="100px"/>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Is Active?" SortExpression="IsActive">
                    <ItemTemplate>
                        <%#(bool)Eval("IsActive") ? "Yes" : "No" %>
                    </ItemTemplate>
                    <HeaderStyle HorizontalAlign="Left" CssClass="header" />
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                        <blockquote>There are no items to show.</blockquote>
                    </EmptyDataTemplate>
        </asp:GridView>
    </ContentTemplate>
</asp:UpdatePanel>
<div class="grid740 simplebox">
    <asp:ObjectDataSource ID="ObjectDataSourceDepartmentList" runat="server" TypeName="AB.ServiceDirectory.BO.DepartmentBO"
        SelectMethod="GetDepartment" OnSelecting="ObjectDataSourceDepartmentList_Selecting"
        EnablePaging="True" SelectCountMethod="GetDepartmentCount" StartRowIndexParameterName="startRowIndex"
        MaximumRowsParameterName="maxRows" SortParameterName="sortType">
        <SelectParameters>
            <asp:Parameter Name="filter" Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
</div>
